package com.example.project.controller;

import com.example.project.entity.Employee;
import com.example.project.service.IEmployeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/**
 * 编写者：王住泽
 * 时间：2023/10/28
 */
@RestController
@Api
public class EmployeeController {
    @Autowired
    private IEmployeeService employeeServic;
    @RequestMapping("/Employee")
    public String Employee(){
        return "员工信息管理系统";
    }
    @ApiOperation(value = "添加员工信息")
    @RequestMapping("addEmployee")
    public int insertEmployee(Employee employee){
        return employeeServic.insertEmployee(employee);
    }
    @ApiOperation(value = "删除员工信息")
    @RequestMapping("/deletEmployeee")
    public int delectEmployee(int Id){
        Employee employee=new Employee();
        employee.setId(Id);
        return employeeServic.deleteEmployee(employee);
    }
    @ApiOperation(value = "修改员工信息",
            notes = "成功返回1")
    @RequestMapping("/updateEmployee")
    public int updateEmployee(Employee employee){
        return employeeServic.updateEmployee(employee);
    }
    @ApiOperation(value = "查询所有员工信息",
            notes = "成功返回1")
    @RequestMapping("/getAllEmployee")
    public List<Employee> getAllEmployee(Employee employee){
        return employeeServic.getAllEmployee(employee);
    }
}